using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using MailMerge.Builders;

namespace MailMerge.CommandLine
{
	class Program
	{
		[STAThread]
		static void Main(string[] args)
		{
			//emulate fetching data from a database and populating the model...
			var data = new List<ArrearsModel>()
			           	{
			           		new ArrearsModel()
			           			{
			           				Address = "124 Woolsworth Lane",
			           				ArrearsAmount = "34.0",
			           				Salutation = "Good morning Mr. Sheffield",
			           			},
							new ArrearsModel()
								{
									Address = "64 Zoo Lane",
									ArrearsAmount = "123.45",
									Salutation = "Hey you, get off of my cloud!"
								}
			           	};

			string tempfile = args.Length == 0 ? Path.GetRandomFileName() + ".docx" : args[0];

			using (var arrearsMerge = new MergeBuilder(data))
				arrearsMerge.Build(tempfile);

			//To view output - render in word....

			Process.Start(tempfile);
		}
	}
}